﻿package mortal.game.view.heroArena.view
{
    import Message.DB.Tables.*;
    import Message.Public.*;
    import baseEngine.modifiers.*;
    import com.gengine.core.frame.*;
    import com.mui.containers.globalVariable.*;
    import com.mui.controls.*;
    import com.mui.core.*;
    import com.mui.events.*;
    import com.mui.utils.*;
    import extend.language.*;
    import fl.controls.*;
    import fl.data.*;
    import flash.events.*;
    import flash.geom.*;
    import frEngine.effectEditTool.temple.*;
    import frEngine.pools.*;
    import frEngine.primitives.object2d.*;
    import frEngine.render.layer.*;
    import mortal.common.global.*;
    import mortal.component.GCatogeryList.*;
    import mortal.component.rotate3dModelSprite.*;
    import mortal.component.window.*;
    import mortal.game.cache.*;
    import mortal.game.events.*;
    import mortal.game.manager.*;
    import mortal.game.manager.window3d.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.scene3D.model.data.*;
    import mortal.game.scene3D.model.player.*;
    import mortal.game.scene3D.model.player.weapon.*;
    import mortal.game.scene3D.model.pools.*;
    import mortal.game.scene3D.player.entity.*;
    import mortal.game.scene3D.player.type.*;
    import mortal.game.view.arena.data.*;
    import mortal.game.view.arena.util.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.item.*;
    import mortal.game.view.heroArena.util.*;
    import mortal.game.view.mount.data.*;
    import mortal.game.view.wizard.*;
    import mortal.mvc.core.*;
    import mortal.mvc.interfaces.*;

    public class HeroArenaSettleRuleWin extends BaseWindow
    {
        private var _tabBar:GTabarNew;
        private var _bg:GImageBitmap;
        private var _categoryList:GCatogeryList;
        private var _rotate3d:Rotate3dModelSprite;
        private var _imgSpr:GSprite;
        private var _rewardItemArr:Array;
        private var _pointInfo:Array;
        private var _tabData:Array;
        private var _rect3d:Rect3DObject;
        private var _img2d:Img2D;
        private var _scale9gridImg2d:Scale9GridImg2DEx;
        private var _bodyPlayer:ActionPlayer;
        private var _weaponPlayer:WeaponPlayer;
        private var _weaponEffectPlayer:EffectPlayer;
        private var _frameTimer:FrameTimer;
        private var _mountHangEffect:EffectPlayer;
        private var _userModelPlayer:UserModelPlayer;
        private var _turnNum:Number = 0;
        private var _selIndex:int;
        private var _headData:ArenaWeekRuleData;
        private var _modelType:int;
        private static var _instance:HeroArenaSettleRuleWin;

        public function HeroArenaSettleRuleWin(param1:ILayer = null)
        {
            this._rewardItemArr = [];
            this._pointInfo = [];
            this._tabData = Language.getArray(41582);
            super(param1);
            setSize(381 - 5, 603 - 8 + 3);
            this.layer = LayerManager.windowLayer3D;
            title = Language.getString(41583);
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            isForbidenDrag = true;
            this._tabBar = UIFactory.gTabBarNew(3, 32, this._tabData, 381 - 5, 603 - 8 + 3, 80, 26, this, this.onTabBarChange, "TabButtonNew");
            this._tabBar.selectedIndex = 0;
            this.init3DRect();
            this._bg = UIFactory.gImageBitmap("", 0, 0, null, this.onBgLoadCompl);
            this._imgSpr = UICompomentPool.getUICompoment(GSprite);
            this._imgSpr.x = 10;
            this._imgSpr.y = 70;
            this.contentTopOf3DSprite.addChild(this._imgSpr);
            this._rotate3d = UIFactory.getUICompoment(Rotate3dModelSprite, 11, 66, this.contentTopOf3DSprite);
            this._rotate3d.setSize(363, 505 + 29);
            this._categoryList = UICompomentPool.getUICompoment(GCatogeryList);
            this._categoryList.setListSize(390, 502 + 35);
            this._categoryList.x = 12 - 10;
            this._categoryList.y = 67 - 1;
            this._categoryList.tileList.direction = GBoxDirection.VERTICAL;
            this._categoryList.tileList.columnWidth = 383;
            this._categoryList.tileList.columnCount = 1;
            this._categoryList.headGap = 2;
            this._categoryList.tileList.verticalScrollPolicy = ScrollPolicy.ON;
            this._categoryList.scrollPane.verticalScrollPolicy = ScrollPolicy.OFF;
            this.contentTopOf3DSprite.addChild(this._categoryList);
            this._categoryList.visible = false;
            this.pushUIToDisposeVec(UIFactory.gTextField(Language.getString(41584), 90, 577, 240, 20, this.contentTopOf3DSprite, GlobalStyle.textFormatLv));
            this.initListData();
            this.addListeners();
            this.onTabBarChange();
            return;
        }// end function

        private function addListeners() : void
        {
            Dispatcher.addEventListener(EventName.ArenaSettleExpand, this.onExpandHandler);
            Dispatcher.addEventListener(EventName.ArenaSettleUnExpand, this.onUnExpandHandler);
            Dispatcher.addEventListener(EventName.WindowClosed, this.onWinClose);
            return;
        }// end function

        private function removeListeners() : void
        {
            Dispatcher.removeEventListener(EventName.ArenaSettleExpand, this.onExpandHandler);
            Dispatcher.removeEventListener(EventName.ArenaSettleUnExpand, this.onUnExpandHandler);
            Dispatcher.removeEventListener(EventName.WindowClosed, this.onWinClose);
            return;
        }// end function

        private function init3DRect() : void
        {
            var _loc_1:Rectangle = null;
            if (this._rect3d == null)
            {
                this._rect3d = Rect3DManager.instance.registerWindow(true, new Rectangle(11, 66, 363, 505 + 29), this);
                Rect3DManager.instance.windowShowHander(null, this);
            }
            if (this._scale9gridImg2d == null)
            {
                _loc_1 = new Rectangle(33, 38, 1, 1);
                this._scale9gridImg2d = new Scale9GridImg2DEx(null, GlobalClass.getBitmapData(ImagesConst.PlayerBg), true, _loc_1);
                this._scale9gridImg2d.SetSize(363 + 2, 505 + 29 + 5, -2, -2);
                this._rect3d.addImg(this._scale9gridImg2d, Layer3DManager.backGroudImgLayer);
            }
            return;
        }// end function

        private function onBgLoadCompl() : void
        {
            this.add3dBg();
            return;
        }// end function

        private function add3dBg() : void
        {
            if (this._rect3d)
            {
                this._rect3d.removeImg(this._img2d);
                this._img2d = new Img2D(null, this._bg.bitmapData, new Rectangle(0, 0, 355, 252), false);
                this._img2d.x = 4;
                this._img2d.y = 53 + 52 * this._selIndex;
                this._rect3d.addImg(this._img2d);
                this.addModel();
            }
            return;
        }// end function

        private function addModel() : void
        {
            if (this._modelType == ArenaConst.ModelType_Mount)
            {
                this.addMount();
            }
            if (this._modelType == ArenaConst.ModelType_Weapon)
            {
                this.addWeapon();
            }
            if (this._modelType == ArenaConst.ModelType_ClothWing)
            {
                this.addClothWing();
            }
            return;
        }// end function

        private function addMount() : void
        {
            var _loc_1:* = ArenaUtil.getGiftItems(this._headData.itemCode);
            if (_loc_1.length == 0)
            {
                return;
            }
            var _loc_2:* = _loc_1[0] as ItemData;
            if (!ArenaUtil.isEquipItemCode(_loc_2.itemCode))
            {
                return;
            }
            var _loc_3:* = (_loc_2.itemInfo as ItemEquipInfo).modelId;
            var _loc_4:* = ModelConfig.instance.getInfoByCode(_loc_3);
            if (_loc_4 == null)
            {
                return;
            }
            var _loc_5:* = _loc_4.mesh1 + ".md5mesh";
            var _loc_6:* = _loc_4.texture1;
            var _loc_7:* = _loc_4.bone1 + ".skeleton";
            if (this._bodyPlayer)
            {
                this._rect3d.disposeObj3d(this._bodyPlayer);
            }
            this._bodyPlayer = FrObjectPool.getObject(ActionPlayer, this);
            this._bodyPlayer.changeAction(ActionName.Stand);
            this._bodyPlayer.selectEnabled = false;
            this._bodyPlayer.play();
            this._bodyPlayer.scaleValue = 0.5;
            this._bodyPlayer.setRotation(0, 45, 0);
            this._bodyPlayer.load(_loc_5, _loc_7, _loc_6, this._rect3d.renderList);
            this._rect3d.addObject3d(this._bodyPlayer, 180 - 40, 260 + 53 * this._selIndex);
            this._rotate3d.model = this._bodyPlayer;
            var _loc_8:* = Cache.instance.mount.mountData;
            if (this._rect3d && _loc_8)
            {
                if (this._mountHangEffect)
                {
                    this._rect3d.disposeObj3d(this._mountHangEffect);
                    this._mountHangEffect = null;
                }
                if (_loc_4.effect1)
                {
                    this._mountHangEffect = EffectPlayerPool.instance.getEffectPlayer(_loc_4.effect1, this._bodyPlayer, this._rect3d.renderList, false);
                    if (this._mountHangEffect.temple is TempleRole)
                    {
                        (this._mountHangEffect.temple as TempleRole).setRoleParams(this._bodyPlayer, null, null);
                    }
                    this._mountHangEffect.play(PlayMode.ANIMATION_LOOP_MODE);
                }
            }
            return;
        }// end function

        private function addWeapon() : void
        {
            var _loc_3:UserModelPlayer = null;
            var _loc_4:int = 0;
            var _loc_5:int = 0;
            var _loc_6:int = 0;
            var _loc_7:int = 0;
            var _loc_8:int = 0;
            var _loc_9:int = 0;
            var _loc_10:int = 0;
            var _loc_11:int = 0;
            var _loc_12:int = 0;
            var _loc_13:ItemData = null;
            var _loc_14:int = 0;
            var _loc_15:TPlayerModel = null;
            var _loc_1:* = ArenaUtil.getGiftItems(this._headData.itemCode);
            var _loc_2:Array = [];
            if (_loc_1.length > 0)
            {
                if (ArenaUtil.isGiftItemCode(_loc_1[0].itemCode))
                {
                    _loc_2 = ArenaUtil.getGiftItems(_loc_1[0].itemCode);
                }
                if (_loc_2.length == 0)
                {
                    return;
                }
            }
            if (this._rect3d)
            {
                _loc_3 = FrObjectPool.getObject(UserModelPlayer, this);
                _loc_4 = Cache.instance.role.entityInfo.career;
                _loc_5 = Cache.instance.role.entityInfo.sex;
                _loc_6 = Cache.instance.role.roleEntityInfo.clothes;
                _loc_7 = Cache.instance.role.roleEntityInfo.weapon;
                _loc_8 = Cache.instance.role.roleEntityInfo.hair;
                _loc_9 = Cache.instance.role.roleEntityInfo.wing;
                _loc_10 = Cache.instance.role.roleEntityInfo.entityInfo.VIP;
                _loc_3.updateInfo(_loc_4, _loc_5, _loc_6, _loc_7, _loc_8, _loc_9, _loc_10);
                this._weaponPlayer = FrObjectPool.getObject(WeaponPlayer, this);
                this._weaponPlayer.enabledPool = false;
                this._weaponPlayer.scaleX = 1.5;
                this._weaponPlayer.scaleY = 1.5;
                this._weaponPlayer.scaleZ = 1.5;
                this._weaponPlayer.rotationZ = -20;
                switch(_loc_4)
                {
                    case ECareer._ECareerWarrior:
                    {
                        _loc_11 = 180 - 40;
                        _loc_12 = 245 + 52 * this._selIndex;
                        break;
                    }
                    case ECareer._ECareerArcher:
                    {
                        _loc_11 = 180 - 40;
                        _loc_12 = 165 + 52 * this._selIndex;
                        break;
                    }
                    case ECareer._ECareerMage:
                    {
                        _loc_11 = 180 - 40;
                        _loc_12 = 185 + 52 * this._selIndex;
                        break;
                    }
                    default:
                    {
                        break;
                    }
                }
                this._rect3d.addObject3d(this._weaponPlayer, _loc_11, _loc_12);
                _loc_13 = _loc_2[0] as ItemData;
                _loc_14 = (_loc_13.itemInfo as ItemEquipInfo).modelId;
                _loc_15 = _loc_3.getModelInfo(ModelType.WEAPONS, _loc_14);
                this._weaponPlayer.load(_loc_15.mesh + ".md5mesh", _loc_15.texture, this._rect3d.renderList);
                this.stopTurn();
                if (this._frameTimer == null)
                {
                    this._frameTimer = new FrameTimer();
                    this._frameTimer.addListener(TimerType.ENTERFRAME, this.onTimerFrameHandler);
                }
                this._frameTimer.start();
                this.removeWeaponEffect();
                if (_loc_15 && _loc_15.selfEffect)
                {
                    this._weaponEffectPlayer = EffectPlayerPool.instance.getEffectPlayer(_loc_15.selfEffect, this._weaponPlayer, this._rect3d.renderList, true);
                    if (this._weaponEffectPlayer.temple is TempleRole)
                    {
                        (this._weaponEffectPlayer.temple as TempleRole).setRoleParams(this._weaponPlayer, null, null);
                    }
                    this._weaponEffectPlayer.play();
                }
            }
            return;
        }// end function

        private function onTimerFrameHandler(param1:FrameTimer) : void
        {
            this.modelTurn();
            return;
        }// end function

        private function stopTurn() : void
        {
            if (this._frameTimer)
            {
                this._frameTimer.stop();
            }
            this._turnNum = 0;
            return;
        }// end function

        private function modelTurn() : void
        {
            var _loc_1:* = this._turnNum + 0.1;
            this._turnNum = this._turnNum + 0.1;
            this._weaponPlayer.y = this._weaponPlayer.y + Math.cos(_loc_1) * 1;
            this._weaponPlayer.rotationY = this._weaponPlayer.rotationY + 5;
            return;
        }// end function

        private function addClothWing() : void
        {
            var _loc_4:int = 0;
            var _loc_5:int = 0;
            var _loc_6:int = 0;
            var _loc_7:int = 0;
            var _loc_8:int = 0;
            var _loc_9:int = 0;
            var _loc_10:int = 0;
            var _loc_1:* = ArenaUtil.getGiftItems(this._headData.itemCode);
            if (_loc_1.length == 0)
            {
                return;
            }
            var _loc_2:* = _loc_1[0] as ItemData;
            if (!ArenaUtil.isEquipItemCode(_loc_2.itemCode))
            {
                return;
            }
            var _loc_3:* = (_loc_2.itemInfo as ItemEquipInfo).modelId;
            if (this._rect3d)
            {
                this._userModelPlayer = FrObjectPool.getObject(UserModelPlayer, this);
                _loc_4 = Cache.instance.role.entityInfo.career;
                _loc_5 = Cache.instance.role.entityInfo.sex;
                _loc_6 = Cache.instance.role.roleEntityInfo.clothes;
                _loc_7 = Cache.instance.role.roleEntityInfo.weapon;
                _loc_8 = Cache.instance.role.roleEntityInfo.hair;
                _loc_9 = Cache.instance.role.roleEntityInfo.wing;
                _loc_10 = Cache.instance.role.roleEntityInfo.entityInfo.VIP;
                this._userModelPlayer.updateIsShowEffect(true, true, true);
                if (_loc_2.itemInfo.category == EProp._EPropFashionClothesEquip)
                {
                    this._userModelPlayer.updateInfo(_loc_4, _loc_5, _loc_6, 0, 0, 0, _loc_10);
                }
                else
                {
                    this._userModelPlayer.updateInfo(_loc_4, _loc_5, _loc_6, 0, 0, _loc_9, _loc_10);
                }
                this._userModelPlayer.scaleAll = 1.5;
                this._userModelPlayer.useLight();
                this._userModelPlayer.setRotation(0, 0, 0);
                this._rect3d.addObject3d(this._userModelPlayer, 180 - 40, 260 + 53 * this._selIndex);
                this._rotate3d.model = this._userModelPlayer;
                if (_loc_2.itemInfo.category == EProp._EPropFashionClothesEquip)
                {
                    this._userModelPlayer.clothes = _loc_3;
                    this._userModelPlayer.loadClothes();
                }
                else
                {
                    this._userModelPlayer.wing = _loc_3;
                    this._userModelPlayer.loadWing();
                }
            }
            return;
        }// end function

        private function initListData() : void
        {
            var _loc_3:DataProvider = null;
            var _loc_1:* = Language.getArray(40709);
            this._categoryList.createHeads(HeroArenaSettleCategoryHead, _loc_1, 390, 50);
            this._categoryList.setCellRender(0, HeroArenaSettleCategoryRenderer, true);
            this._categoryList.setCellHeight(0, 50, true);
            this._categoryList.setListItemHeight(253);
            var _loc_2:int = 0;
            while (_loc_2 < _loc_1.length)
            {
                
                _loc_3 = new DataProvider();
                _loc_3.addItem(new ItemData(470120003));
                this._categoryList.setDataProvider(_loc_2, _loc_3);
                _loc_2++;
            }
            return;
        }// end function

        public function openPanelByTab(param1:int) : void
        {
            this.show();
            this._tabBar.selectedIndex = param1;
            this.onTabBarChange();
            return;
        }// end function

        private function onTabBarChange(event:MuiEvent = null) : void
        {
            this.clearUI();
            this.updateList(this._tabBar.selectedIndex);
            return;
        }// end function

        private function updateList(param1:int) : void
        {
            switch(param1)
            {
                case 0:
                {
                    this.updateDayRuleList();
                    break;
                }
                case 1:
                {
                    this._categoryList.visible = true;
                    this.updateWeekRuleList();
                    this._categoryList.expandItem(0);
                    break;
                }
                case 2:
                {
                    this._categoryList.visible = true;
                    this.updateMonthRuleList();
                    this._categoryList.expandItem(0);
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

        private function updateDayRuleList() : void
        {
            var _loc_3:HeroArenaPointRuleSpr = null;
            this._imgSpr.visible = true;
            var _loc_1:* = HeroArenaUtil.getArenaDayRuleData();
            var _loc_2:int = 0;
            while (_loc_2 < _loc_1.length)
            {
                
                _loc_3 = UICompomentPool.getUICompoment(HeroArenaPointRuleSpr);
                _loc_3.x = 8;
                _loc_3.y = 85 * _loc_2;
                this._imgSpr.addChild(_loc_3);
                _loc_3.index = _loc_2;
                _loc_3.data = _loc_1[_loc_2];
                _loc_3.bg = "HeroArenaPointReward_" + (_loc_2 + 1);
                this._pointInfo.push(_loc_3);
                _loc_2++;
            }
            return;
        }// end function

        private function updateWeekRuleList() : void
        {
            var _loc_1:* = HeroArenaUtil.getArenaWeekRuleData(EArenaRewardType._EArenaRewardTypeWeek);
            this._categoryList.updateHeads(_loc_1);
            return;
        }// end function

        private function updateMonthRuleList() : void
        {
            var _loc_1:* = HeroArenaUtil.getArenaWeekRuleData(EArenaRewardType._EArenaRewardTypeMouth);
            this._categoryList.updateHeads(_loc_1);
            return;
        }// end function

        private function onExpandHandler(event:DataEvent) : void
        {
            this._selIndex = event.data.index as int;
            this._headData = event.data.headData as ArenaWeekRuleData;
            if (this._headData)
            {
                if (this._headData.type == EArenaRewardType._EArenaRewardTypeWeek)
                {
                    if (this._headData.rankMinValue <= 3)
                    {
                        this._bg.imgUrl = ImagesConst.ArenaPreviewBg_2;
                        this._modelType = ArenaUtil.getModelTypeByItemCode(this._headData.itemCode);
                    }
                    else
                    {
                        this._bg.imgUrl = ImagesConst.ArenaPreviewBg_1;
                        this._modelType = ArenaConst.ModelType_NotNeed;
                    }
                }
                if (this._headData.type == EArenaRewardType._EArenaRewardTypeMouth)
                {
                    if (this._headData.rankMinValue <= 5)
                    {
                        this._bg.imgUrl = ImagesConst.ArenaPreviewBg_3;
                        this._modelType = ArenaUtil.getModelTypeByItemCode(this._headData.itemCode);
                    }
                    else
                    {
                        this._bg.imgUrl = ImagesConst.ArenaPreviewBg_1;
                        this._modelType = ArenaConst.ModelType_NotNeed;
                    }
                }
                this.addItem();
            }
            return;
        }// end function

        private function onUnExpandHandler(event:DataEvent) : void
        {
            this.clear3D();
            this.removeItem();
            this._selIndex = -1;
            return;
        }// end function

        private function addItem() : void
        {
            var _loc_1:Array = null;
            var _loc_2:int = 0;
            var _loc_3:BaseItem = null;
            var _loc_4:int = 0;
            _loc_1 = ArenaUtil.getGiftItems(this._headData.itemCode);
            if (this._modelType != ArenaConst.ModelType_NotNeed)
            {
                _loc_2 = 0;
                while (_loc_2 < _loc_1.length)
                {
                    
                    _loc_3 = UICompomentPool.getUICompoment(BaseItem);
                    _loc_3.setItemStyle(72, ImagesConst.PackItemBg);
                    _loc_3.x = 290;
                    _loc_3.y = 123 + 53 * this._selIndex + 79 * _loc_2;
                    this.contentTopOf3DSprite.addChild(_loc_3);
                    if (this._modelType == ArenaConst.ModelType_Weapon && _loc_2 == 0 && ArenaUtil.isGiftItemCode(_loc_1[_loc_2].itemCode))
                    {
                        _loc_3.itemData = ArenaUtil.getWeaponData(_loc_1[_loc_2].itemCode);
                    }
                    else
                    {
                        _loc_3.itemData = _loc_1[_loc_2] as ItemData;
                    }
                    if (_loc_3.itemData.extData && _loc_3.itemData.extData.isRandomGet)
                    {
                        _loc_3.labelText = Language.getString(41585);
                    }
                    this._rewardItemArr.push(_loc_3);
                    _loc_2++;
                }
            }
            else
            {
                _loc_4 = (this.contentTopOf3DSprite.width - (79 * _loc_1.length - 7)) / 2;
                _loc_2 = 0;
                while (_loc_2 < _loc_1.length)
                {
                    
                    _loc_3 = UICompomentPool.getUICompoment(BaseItem);
                    _loc_3.setItemStyle(72, ImagesConst.PackItemBg);
                    _loc_3.x = _loc_4 + 79 * _loc_2;
                    _loc_3.y = 280 + 53 * this._selIndex;
                    this.contentTopOf3DSprite.addChild(_loc_3);
                    _loc_3.itemData = _loc_1[_loc_2] as ItemData;
                    this._rewardItemArr.push(_loc_3);
                    if (_loc_3.itemData.extData && _loc_3.itemData.extData.isRandomGet)
                    {
                        _loc_3.labelText = Language.getString(41585);
                    }
                    _loc_2++;
                }
            }
            return;
        }// end function

        private function removeItem() : void
        {
            var _loc_1:BaseItem = null;
            for each (_loc_1 in this._rewardItemArr)
            {
                
                if (_loc_1)
                {
                    _loc_1.dispose();
                    _loc_1 = null;
                }
            }
            this._rewardItemArr.length = 0;
            return;
        }// end function

        private function removeWeaponEffect() : void
        {
            if (this._weaponEffectPlayer)
            {
                this._weaponEffectPlayer.dispose();
                this._weaponEffectPlayer = null;
            }
            return;
        }// end function

        private function removePointPart() : void
        {
            var _loc_1:HeroArenaPointRuleSpr = null;
            for each (_loc_1 in this._pointInfo)
            {
                
                _loc_1.dispose();
                _loc_1 = null;
            }
            this._pointInfo.length = 0;
            return;
        }// end function

        private function clearUI() : void
        {
            this._imgSpr.visible = false;
            if (this._tabBar.selectedIndex == 0)
            {
                this._categoryList.unexpandAllItem();
            }
            this._categoryList.visible = false;
            this.clear3D();
            this.removeItem();
            this.removePointPart();
            return;
        }// end function

        private function clear3D() : void
        {
            if (this._rect3d)
            {
                if (this._img2d)
                {
                    this._rect3d.removeImg(this._img2d);
                    this._img2d = null;
                }
                if (this._bodyPlayer)
                {
                    this._rect3d.disposeObj3d(this._bodyPlayer);
                    this._bodyPlayer = null;
                }
                if (this._mountHangEffect)
                {
                    this._rect3d.disposeObj3d(this._mountHangEffect);
                    this._mountHangEffect = null;
                }
                this.stopTurn();
                if (this._weaponPlayer)
                {
                    this._rect3d.disposeObj3d(this._weaponPlayer);
                    this._weaponPlayer = null;
                }
                if (this._weaponEffectPlayer)
                {
                    this._rect3d.disposeObj3d(this._weaponEffectPlayer);
                    this._weaponEffectPlayer = null;
                }
                if (this._userModelPlayer)
                {
                    this._rect3d.disposeObj3d(this._userModelPlayer);
                    this._userModelPlayer = null;
                }
            }
            return;
        }// end function

        private function remove3D() : void
        {
            this.clear3D();
            if (this._rect3d)
            {
                if (this._scale9gridImg2d)
                {
                    this._rect3d.disposeObj3d(this._scale9gridImg2d);
                    this._scale9gridImg2d = null;
                }
                Rect3DManager.instance.disposeRect3d(this._rect3d);
                this._rect3d = null;
            }
            return;
        }// end function

        override public function show(param1:int = 0, param2:int = 0) : void
        {
            super.show();
            this.x = HeroArenaMainWin.instance.x + HeroArenaMainWin.instance.width + 5;
            this.y = HeroArenaMainWin.instance.y;
            if (!HeroArenaMainWin.instance.isHide)
            {
                LayerManager.windowLayer.centerWindows(HeroArenaMainWin.instance, this);
            }
            return;
        }// end function

        private function onWinClose(event:DataEvent) : void
        {
            if (event.data == HeroArenaMainWin.instance)
            {
                this.hide();
            }
            return;
        }// end function

        override protected function onWindowDownHandler(event:MouseEvent) : void
        {
            super.onWindowDownHandler(event);
            PopupManager.setTop(HeroArenaMainWin.instance);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl();
            this._bg.dispose();
            this._bg = null;
            this._rotate3d.dispose();
            this._rotate3d = null;
            this._tabBar.dispose();
            this._tabBar = null;
            this._imgSpr.dispose();
            this._imgSpr = null;
            this._categoryList.dispose();
            this._selIndex = -1;
            this._headData = null;
            if (this._frameTimer)
            {
                this._frameTimer.dispose();
                this._frameTimer = null;
            }
            this.remove3D();
            this.removeItem();
            this.removePointPart();
            this.removeListeners();
            return;
        }// end function

        public static function get instance() : HeroArenaSettleRuleWin
        {
            if (_instance == null)
            {
                _instance = new HeroArenaSettleRuleWin;
            }
            return _instance;
        }// end function

        public static function get isViewShow() : Boolean
        {
            return _instance && !_instance.isHide;
        }// end function

    }
}
